package task04;

import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class Tracker {
    private final Map<String, Point> map;
    private final Map<String, Point> unmodifiableMap;

    public Tracker() {
        map = new ConcurrentHashMap<>();
        unmodifiableMap = Collections.unmodifiableMap(map);
    }

    public Tracker(Map<String, Point> newMap) {
        map = new ConcurrentHashMap<>(newMap);
        unmodifiableMap = Collections.unmodifiableMap(map);
    }

    public void setLoc(String id, Point point) {
        map.put(id, point);
    }

    public Point getLoc(String id) {
        return map.get(id);
    }

    public Map<String, Point> getLocations() {
        return unmodifiableMap;
    }
}
